#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

struct Stu {
	char name[30];
	int age;
};

int struct_cmp_by_name(const void* e1, const void* e2)
{
	return strcmp((*(struct Stu*)e1).name, (*(struct Stu*)e2).name);
}

int main()
{
	struct Stu s[3] = { {"zhangsan", 26} , {"lisi", 12} , {"wangwu" , 54} };
	int sz = sizeof(s) / sizeof(s[0]);
	qsort(s, sz, sizeof(s[0]), struct_cmp_by_name);
	return 0;
}
